#ifndef _BOOTLOAD_H_
#define _BOOTLOAD_H_
#include <stdio.h>
#include <stdint.h>
#include <stdbool.h>
#include <string.h>
#include "gd32w51x.h"


#define UART_SOF    				0xAA
#define UART_EOF    				0xBB

#define SECTOR_SIZE					(1024U*4U)

#define BOOT_SIZE					(1024U*64U)
#define APP_ADDRESS	        		(FLASH_BASE + BOOT_SIZE)
//	#define APP_END_ADDRESS     		0x08040000
#define UP_FLAG_ADDR				(APP_ADDRESS - SECTOR_SIZE)

#define LD_BL_VER   				"3.3"
#define WAIT_AP_ROM_UPDATE  		0xA1A2A3A4
#define CMD_BUFF_SIZE				2048
#define HEARTBEAT_TIME				12000


void bootload_init(void);
void bootload_task(void);
void bootload_timer(void);
void bootload_uart_recv(uint16_t byte);
void bootload_ble_recv(uint16_t byte);

#endif

